package JUC;

@FunctionalInterface  //申明为函数式接口
interface Foo {

    //public void say();

    public int add(int a,int b);

    //java 8 接口可以有方法的实现 default,可以有多个
    default int div(int x,int y){
        return x/y;
    }

    public static int multiply(int x,int y){
        return x * y;
    }

}

public class LambdaExpress {

    public static void main(String[] args) {

      /*  Foo foo = new Foo() {
            @Override
            public void say() {
                System.out.println("hello foo");
            }
        };

        foo.say();*/

       /* Foo foo = () -> {
            System.out.println("hello lambda express");
        };
        foo.say();*/

        Foo foo = (a,b)->{
            return  a+b;
        };
        System.out.println(foo.add(1,2));

        System.out.println(foo.div(10, 5));

        System.out.println(Foo.multiply(3, 5));


    }
}
